package com.fuhao.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.util.SerializationUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhang
 * @title: DirSendController
 * @projectName spring-rabbit
 * @description: TODO
 * @date 2019/5/2017:23
 */
@RestController
public class DirSendController {

    @Autowired
    @Qualifier("rabbitDirTemplate")
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/dirSend")
    public String send(){
        Map<String,String> map = new HashMap<>();
        map.put("name","张三");
        rabbitTemplate.convertAndSend("dir_key1", map);
        return "success";
    }
}
